<%@ page language="java" contentType="text/html; charset=utf8" pageEncoding="utf8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<html>
<head>
	<LINK rel="stylesheet" type="text/css" href="css/styles.css">  
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
	<script type="text/javascript" src="js/easypaginate.js"></script>
	
	<script type="text/javascript">
	
		jQuery(function($){
			$('ul#items').easyPaginate({
				step:2
			});
		});    
		
		function doPopup(popupPath) {
			window.open(popupPath,'name',
			'width=400,height=200,scrollbars=YES');
		}
    </script>
    
	<style>

		blockquote, ul, ol, dl, pre{line-height:inherit;margin:0 0 1.5em 0;}
		ul, ol, dl{padding:0;}
		
		/* content */

		#container
		{	
			margin:0 auto;
			width: 716px;
			text-align:left;
			position:relative;
			padding:2em 0;
		}
		
		ul#items
		{		
			margin:1em 0;
			width:auto;
			height:250px;
			overflow:hidden;
			}
			
		ul#items li
		{
			list-style:none;
			float:left;
			height:250px;
			overflow:hidden;
			margin:0 4px;
			}
			
		ul#items li:hover{color:#333;}
		ul#items li .image{
			margin:20px 20px 10px 20px;
			width:220px;
			height:150px;
			overflow:hidden;
			border:2px solid #fff;
			-moz-box-shadow:0 1px 1px #bbb;
			-webkit-box-shadow:0 1px 1px #bbb;
			box-shadow:0 1px 1px #bbb;
		}	
		ul#items h3{text-transform:uppercase;font-size:14px;font-weight:bold;margin:.25em 0;text-shadow:#f1f1f1 0 1px 0;}	
		ul#items .info{color:#999;text-shadow:#f1f1f1 0 1px 0;}	
		ol#pagination{position:relative;text-align:center;}
		ol#pagination li{
			display:inline-block;
			width:16px;
			height:16px;
			background:url(images/bg_buttons.png) no-repeat 0 0;
			text-align:left;
			text-indent:-8000px;
			list-style:none;
			cursor:pointer;
			margin:0 2px;
			}
		ol#pagination li:hover{background:url(images/bg_buttons.png) no-repeat 0 -16px;}
		ol#pagination li.current{color:#f00;font-weight:bold;background:url(images/bg_buttons.png) no-repeat 0 -32px;}
		ol#pagination li.prev, ol#pagination li.next{
			position:absolute;
			top:-150px;
			}
		ol#pagination li.prev{left:-30px;background:url(images/bg_buttons.png) no-repeat 0 -64px;}
		ol#pagination li.next{right:-30px;background:url(images/bg_buttons.png) no-repeat 0 -48px;}

	</style>
	<title>Online restarant</title>
</head>
<body bgcolor=#FFA98C>
	<div align=center>
		<table border="0" width="820px" cellspacing="0" cellpadding="0" align=center>
			<tr>
				<td class="left"></td>
				<td width=800>
					<table border="0" width=800 cellspacing="0" cellpadding="0" align=center height="830">
						<tr height="30px">
							<td class="menu_login" colspan="2">&nbsp;</td>
							<td class="menu_login" colspan="3">&nbsp;</td>
							<td class="menu_login" colspan="3">
								<sec:authorize ifAllGranted="ROLE_ADMIN">
									<a class="menu_login" href="/CoffiSweetDreams/admin.htm">Админка</a>
								</sec:authorize>
								<sec:authorize ifAllGranted="ROLE_ANONYMOUS">
									<a class="menu_login" href="/CoffiSweetDreams/index.htm?action=registration" >Регистрация</a>
								</sec:authorize>
							</td>
							<td class="menu_login" colspan="2">
								<sec:authorize ifAllGranted="ROLE_ANONYMOUS">
									<a class="menu_login" href="/CoffiSweetDreams/index.htm?action=login">Войти</a>
								</sec:authorize>
								<sec:authorize ifAnyGranted="ROLE_ADMIN, ROLE_USER">
									<a class="menu_login" href="/CoffiSweetDreams/logout">Выйти</a>
								</sec:authorize>
							</td>
						</tr>
						<tr>
							<td class="logo" colspan="10">&nbsp;</td>
						</tr>
						<tr height="30px">
							<td class="menu_tb" width="50">&nbsp;</td>
							<td class="menu_tb" colspan="2">
								<form method="POST" action="/CoffiSweetDreams/index.htm?action=setdishtype" >
									<input type="text" class="hidenell" readonly name="idtype" value="1" />
									<input type="submit" class="menu_type" value="Супы">
								</form>
							</td>
							<td class="menu_tb">
								<form method="POST" action="/CoffiSweetDreams/index.htm?action=setdishtype" >
									<input type="text" class="hidenell" readonly name="idtype" value="2" />
									<input type="submit" class="menu_type" value="Горячее">
								</form>
							</td>
							<td class="menu_tb" width="140" colspan="2">
								<form method="POST" action="/CoffiSweetDreams/index.htm?action=setdishtype" >
									<input type="text" class="hidenell" readonly name="idtype" value="3" />
									<input type="submit" class="menu_type" value="Салаты">
								</form>									
							</td>
							<td class="menu_tb" >
								<form method="POST" action="/CoffiSweetDreams/index.htm?action=setdishtype" >
									<input type="text" class="hidenell" readonly name="idtype" value="4" />
									<input type="submit" class="menu_type" value="Пасты">
								</form>
							</td>
							<td class="menu_tb" width="140" colspan="2">
								<form method="POST" action="/CoffiSweetDreams/index.htm?action=setdishtype" >
									<input type="text" class="hidenell" readonly name="idtype" value="5" />
									<input type="submit" class="menu_type" value="Десерты">
								</form>
							</td>
							<td class="menu_tb" width="50">&nbsp;</td>
						</tr>
						<tr>
							<td bgcolor=#FFFFFF colspan="10"  valign=top align="center">
								<br/>
								<table border="0" width="98%" cellspacing="0" cellpadding="0">
									<tr>
										<td class="box_top_left"></td>
										<td class="box_top_centr"></td>
										<td class="box_top_right"></td>
									</tr>
									<tr>
									<td class="box_left">&nbsp;</td>
										<td bgcolor="f8be93" align="center">
											<jsp:include page="/WEB-INF/jsp/dishlist.jsp" />	
										</td>
										<td class="box_right">&nbsp;</td>
									</tr>
									<tr>
										<td class="box_bottom_left"></td>
										<td class="box_bottom_centr"></td>
										<td class="box_bottom_right"></td>
									</tr>
								</table>
							</td>
						</tr>
						<tr >
							<td bgcolor=#FFFFFF colspan="10"  valign=top align="center">
								

<% 
	String urlpage="/WEB-INF/jsp/boottom/basked.jsp";
	String action = request.getParameter("action");
								
	if ( action!=null )
	{
		if( action.equals("userinfo") ) 
		{
			urlpage="/WEB-INF/jsp/boottom/info.jsp";
		}
		
		if( action.equals("basked") )
		{
			urlpage="/WEB-INF/jsp/boottom/basked.jsp";
		}														
	}
									
%> 

<jsp:include page='<%= urlpage %>' />


							</td>
						</tr>
						<tr height="30px">
							<jsp:include page="/WEB-INF/jsp/boottom/boottom.jsp" />
						</tr>
						
					</table>
				</td>
				<td class="right">&nbsp;</td>
		</table>							
		<div id="registred">
		
<% 
	String urlreg="/WEB-INF/jsp/window/null.jsp";
		  urlpage="/WEB-INF/jsp/window/null.jsp";
	action = request.getParameter("action");
								
	if ( action!=null )
	{
		if( action.equals("registration") ) 
		{
			urlreg="/WEB-INF/jsp/window/registration.jsp";
		}
		
		if( action.equals("registred") ) 
		{
			urlreg="/WEB-INF/jsp/window/registred.jsp";
		}	
		
		if( action.equals("login") ) 
		{
			urlreg="/WEB-INF/jsp/window/login.jsp";
		}
		
		if( action.equals("errLogin") ) 
		{
			urlreg="/WEB-INF/jsp/window/errLogin.jsp";
		}
		
		if( action.equals("commit") ) 
		{
			urlreg="/WEB-INF/jsp/window/commit.jsp";
		}
		
		if( action.equals("viewuserinfo") ) 
		{
			urlpage="/WEB-INF/jsp/window/useredit.jsp";
		}
		
		if( action.equals("viewhistory") ) 
		{
			urlpage="/WEB-INF/jsp/window/history.jsp";
		}
		
		
	}								
%> 
<jsp:include page='<%= urlreg %>' />	

<sec:authorize ifAnyGranted="ROLE_ADMIN, ROLE_USER">
	<jsp:include page='<%= urlpage %>' />	
</sec:authorize>
	
		
		</div>				
	</body>
</html>